package android.wordcap;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class Summary extends Activity {
	public void onTry(View v) {

	}

	public void onFeeling(View v) {

	}

	public void onNext(View v) {
		Intent intent = new Intent(this, Game.class);
		intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
		startActivity(intent);
		finish();
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_summary);
		getActionBar().hide();
		// score,hint,wrong
		int[] score = getIntent().getIntArrayExtra("score");
		((TextView) findViewById(R.id.summary_score)).setText(Integer
				.toString(score[0]));
		for (int i = 0; i < 3; i++) {
			if (score[i] > 0 && i != 0) {
				continue;
			}
			ImageView imageView = new ImageView(this);
			imageView.setImageResource(R.drawable.summary_star);
			((LinearLayout) findViewById(R.id.summary_star)).addView(imageView);
		}
	}

	@Override
	public void onWindowFocusChanged(boolean hasFocus) {
		super.onWindowFocusChanged(hasFocus);
		if (hasFocus) {
			getWindow().getDecorView().setSystemUiVisibility(
					View.SYSTEM_UI_FLAG_LAYOUT_STABLE
							| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
							| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
							| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
							| View.SYSTEM_UI_FLAG_FULLSCREEN
							| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
		}
	}

	@Override
	public void onBackPressed() {
		Intent intent = new Intent(this, MainActivity.class);
		intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
		startActivity(intent);
		finish();
	}
}
